package com.tuanzi.loan.business.service.sms.el.evaluator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.tuanzi.loan.business.service.family.LoanApiRecordService;
import com.tuanzi.loan.business.service.family.LoanOrderService;
import com.tuanzi.loan.business.service.sms.el.AbstractEvaluator;

@Component
public class EliminateActivityEvaluator extends AbstractEvaluator {

	@Autowired
	private LoanApiRecordService loanApiRecordService;
	@Autowired
	private LoanOrderService loanOrderService;

	public EliminateActivityEvaluator api() {

		// getMatchRuleContext().setResponses(getMatchRuleContext().getResponses().stream()
		// .filter(response ->
		// loanOrderService.countByUserIdAndSourceId(response.getId(),
		// getMatchRuleContext().getRequest().getSelectedActivity()) <= 0)
		// .collect(Collectors.toList()));

		return this;
	}

	public EliminateActivityEvaluator union() {

		// getMatchRuleContext().setResponses(getMatchRuleContext().getResponses().stream()
		// .filter(response ->
		// loanApiRecordService.countByUserIdAndSourceId(response.getId(),
		// getMatchRuleContext().getRequest().getSelectedActivity()) <= 0)
		// .collect(Collectors.toList()));

		return this;
	}

	public EliminateActivityEvaluator installed() {
		// for (ListIterator<SmsSearchResponse> iterator =
		// getMatchRuleContext().getResponses().listIterator(); iterator.hasNext();) {
		// SmsSearchResponse response = iterator.next();
		// Long unionCount =
		// loanApiRecordService.countByUserIdAndSourceId(response.getId(),
		// getMatchRuleContext().getRequest().getSelectedActivity());
		// if (unionCount > 0) {
		// iterator.remove();
		// }
		// }
		return this;
	}
}
